﻿using BenCaoXuan.Infrastructure.Attr;
using BenCaoXuan.Infrastructure.Dto.PC;
using BenCaoXuan.Service.Interface.PC;
using Microsoft.AspNetCore.Mvc;

namespace BenCaoXuan.Api.Admin.Controllers.pc
{
    [ApiGroup("PC(桌面端模块)")]
    public class OrderController : BaseController
    {
        private readonly I_Order_Service _i_Order_Service;

        public OrderController(I_Order_Service i_Order_Service,Service.Interface.admin.I_Login_Service login_Service) : base(login_Service)
        {
            _i_Order_Service=i_Order_Service;
        }



        /// <summary>
        /// 获取所有订单数据
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="key"></param>
        /// <returns></returns>

        [HttpGet]
        public async Task<IActionResult> Get_Order(int? page = 1, int? limit = 5, string? key = "")
        {
            var result = await _i_Order_Service.Get_Order(new Orders_Dto
            {
                limit = limit ?? 5,
                page = page ?? 1,
                key = key ?? ""
            });

            return Ok(result);
        }
        /// <summary>
        /// 订单详情
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Order_Detail(string id)
        {
            var result = await _i_Order_Service.Get_Order_Detail(id);

            return Ok(result);
        }

    }
}
